package com.jeesite.modules.general.web;

import com.jeesite.common.config.Global;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.general.entity.UserInfo;
import com.jeesite.modules.general.service.GeneralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * @author Mr Wu
 * @date 2023/12/7
 */
@Controller
@RequestMapping(value = "${adminPath}/general")
public class GeneralController extends BaseController {

    @Autowired
    private GeneralService generalService;

    /**
     * 用户登录
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "userLogin")
    public String userLogin(UserInfo userInfo){
        String msg = generalService.userLogin(userInfo);
        if (StringUtils.isEmpty(userInfo.getUserCode())) {
            return renderResult(Global.FALSE, text(msg));
        }else {
            return renderResult(Global.TRUE, text("身份核验成功！"),userInfo);
        }
    }

}
